{temp('kefu/head')}
</head>
<body>
	<div class="pd-20">
		<div class="form form-horizontal" id="form-article-add">
			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>文章标题：</label>
				<div class="formControls col-10">
					<input type="text" class="input-text" value="{$xw['title']}" placeholder="" id="title" name="title">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">文章作者：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="{$xw['zuozhe']}" placeholder="" id="zuozhe" name="zuozhe">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>文章内容：</label>
				<div class="formControls col-10"> 
					<script id="editor" type="text/plain" style="width:100%;height:400px;">{$xw['content']}</script> 
				</div>
			</div>
			<div class="row cl">
				<div class="col-10 col-offset-2">
					<button onClick="tj({$xw['id']});" class="btn btn-primary radius" type="submit">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
					<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	function tj(id){
		var title = document.getElementById('title').value;
		var zuozhe = document.getElementById('zuozhe').value;
		var content = UE.getEditor('editor').getContent();
		$.post('{$_url}/kefu/?act=news&met=news_u',{id:id,title:title,zuozhe:zuozhe,content:content},function(data){
			if(data == 'cg'){
				layer.alert('修改成功');
				setTimeout(function(){parent.location.reload();},800);return ;
			}else if(data == 'error'){
				layer.alert('修改失败');return ;
			}else if(data == '-1'){
				layer.alert('文章标题不能为空');return ;
			}else if(data == '-2'){
				layer.alert('文章内容不能为空');return ;
			}
		});
	}
	
	$(function(){
		$('.skin-minimal input').iCheck({
			checkboxClass: 'icheckbox-blue',
			radioClass: 'iradio-blue',
			increaseArea: '20%'
		});
		
		$list = $("#fileList"),
		$btn = $("#btn-star"),
		state = "pending",
		uploader;
	
		var uploader = WebUploader.create({
			auto: true,
			
			// 选择文件的按钮。可选。
			// 内部根据当前运行是创建，可能是input元素，也可能是flash.
			pick: '#filePicker',
		
			// 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
			resize: false,
			// 只允许选择图片文件。
			accept: {
				title: 'Images',
				extensions: 'gif,jpg,jpeg,bmp,png',
				mimeTypes: 'image/*'
			}
		});
		
		var ue = UE.getEditor('editor');
		/* ue.ready(function() {
		    ue.setContent("{$xw['content']}");
		}); */
	});
	</script>
	{temp('kefu/foot')}
</body>
</html>